XD, Hexadecimal dump and load

HUB | Up | Pheedbak | Download | Tree | Topic | A-Z | Search | Hot | New


XD, Hexadecimal dump and load
by John Walker
Revision 1 -- December 30th, 1991

This program was created  out  of  exasperation  with  the  Unix  "od"
program  which,  notwithstanding  its  acronym  of  "octal  dump" will
happily make hexadecimal dumps of files but, in tribute to  the  past,
refuses to display file addresses as anything other than octal.

XD is a hexadecimal file dump program without pretensions of grandeur. It dumps files as hex bytes, optionally showing the same bytes as ISO characters, with non-printing characters (defined according to ISO 8859/1 Latin-1) rendered as periods. File addresses are shown as hex numbers without leading zeroes.

XD has a few more little tricks up its sleeve. If you specify the "-l" option, XD will *read* a dump file in the same format it writes and create a binary file from the hex data. This allows you to dump a binary file with XD, edit it with your favourite text editor, then make a new binary file containing whatever changes you made. When creating a binary file, XD normally assumes you've only changed data in place (neither expanding nor contracting the file) and verifies file addresses to guarantee this. However, if you set the "-s" (stream) option, file addresses are ignored and you're free to insert or delete bytes at will. These options effectively turn your existing text editor into a binary file editor without requiring you to learn any new commands.

Finally, the "-d" option reads a binary file and emits a C language data declaration which contains the data from the file. This is handy when you wish to embed binary data within programs.

XD is written to be as portable as possible. It does assume that file I/O is not subjected to end of line translation; if you're porting it to a system such as MS-DOS which requires binary files to be explicitly declared, you'll have to add code appropriate to your compiler.

AUTHOR
            John Walker
            Autodesk NeuchΓtel
            Avenue des Champs-Montants 14b
            CH-2074 MARIN
            Switzerland
            Usenet: kelvin@Autodesk.com
            Fax:    038/33 88 15
            Voice:  038/33 76 33
This program is in the public domain: "Do what thou wilt shall be the whole of the law". I'd appreciate receiving any bug fixes and/or enhancements, which I'll incorporate in future versions of the program. Please leave the original attribution information intact so that credit and blame may be properly apportioned.


Select any combo of files you'd like to send yourself a compressed tar image of. Executables/scripts are indicated with a trailing `*' character. (Depending upon the browser, it may be necessary to hold down the Ctrl key to select/deselect disjoint items.) a compressed tar image of the above-selected items.
OR, ...
a compressed tar image of the entire xd directory.

Copyright © 1995, Silicon Graphics, Inc.